const mongoose = require('mongoose');
const { getMeta, preSave } = require('../helpers');

/** 定义 Character Schema */
const CharacterSchema = new mongoose.Schema({
  /** 角色名称 admin member */
  name: String,
  /** 展示的文案 */
  title: String,
  /** 权限 */
  power: Object,
  meta: getMeta(),
});

CharacterSchema.pre('save', preSave);

/** 注册 Character shecma */
const UserModel = mongoose.model('Character', CharacterSchema);
